<script setup lang="ts">
/**
 * @用途
 * @author bear
 * @创建时间 2025/10/24
 **/
import { openViewImage } from '@/utils/browserHelper'
import ImageItem from './image-item.vue'

const props = defineProps<{
  list: { url: string }[]
}>()

const imgs = computed(() => {
  return props.list.map((l: any) => {
    return {
      alt: '',
      file_path: l.url
    }
  })
})

function viewImage(index: number, e: any) {
  const img = imgs.value[index]
  if (!img) return
  openViewImage(imgs.value, index, { width: e.width, height: e.height })
}
</script>

<template>
  <div class="img-container overflow-x-auto overflow-y-hidden">
    <ImageItem
      v-for="(logo, index) in imgs"
      :key="index"
      class="ma-2"
      :data-testid="`account-logo-${index}`"
      :url="logo.file_path"
      @click="viewImage(index, $event)"
    >
    </ImageItem>
  </div>
</template>

<style scoped>
.img-container {
  display: flex;
  padding: 5px;
}
</style>
